package com.zhouidea.www.control.Scanner;

import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {
        Scanner scaner = new Scanner(System.in);


        //从键盘接收数据
        int i = 0;
        float f = 0.0f;

        System.out.println("请输入整数");
        //如果...那么
        if (scaner.hasNextInt()){
            i = scaner.nextInt();
            System.out.println("整数数据" + i);
        } else{
            System.out.println("输入的不是整数！");
        }

        System.out.println("请输入小数：");

        //如果...那么
        if (scaner.hasNextFloat()){
            f = scaner.nextFloat();
            System.out.print("小数数据" + f);
        } else{
            System.out.println("输入的不是小数！");
        }

        scaner.close();
    }
}
